package com.lu.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.lu.model.enums.ApprovalStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 商户
 * </p>
 *
 * @author currentCodeAuthor
 * @since 2022-07-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class SysMerchant extends Model<SysMerchant> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 品牌id，空表示没有品牌
     */
    private Long brandId;

    /**
     * 商户类型id
     */
    private Long merchantTypesId;

    /**
     * 商户名称
     */
    private String name;

    /**
     * logo
     */
    private String logo;

    /**
     * 联系人姓名
     */
    private String contactsName;

    /**
     * 联系人电话
     */
    private String contactsPhone;

    /**
     * 状态 0未审核 1审核中 2审核不通过 3审核通过 4禁用 5启用
     * @see ApprovalStatusEnum
     */
    private Integer status;

    /**
     * 用户id（商户账号）
     */
    private Long userId;

    /**
     * 描述
     */
    private String description;

    /**
     * 省
     */
    private String province;

    /**
     * 市
     */
    private String city;

    /**
     * 区
     */
    private String region;

    /**
     * 详细地址
     */
    private String address;

    /**
     * 省市区Code
     */
    private String addressCode;

    /**
     * 经营模式(1线上，2线下，3线上线下)
     * @see BusinessMode
     */
    private Integer businessMode;

    /**
     * 通知手机号
     */
    private String noticePhone;

    /**
     * 店铺类型（1直营 2加盟）
     * @see StoreType
     */
    private Integer storeType;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 结算公司
     */
    private String settlementCompany;

    /**
     * 开票抬头
     */
    private String bill;

    /**
     * 开户行
     */
    private String bankDeposit;

    /**
     * 开户账号
     */
    private String accountNumber;

    /**
     * 收款人
     */
    private String payee;

    /**
     * 结算折扣 value/100
     */
    private Integer settlementDiscount;

    /**
     * 税率 value/100
     */
    private Integer taxRate;

    /**
     * 创建人
     */
    private Long createUserId;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    private Long updateUserId;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 门店数量
     */
    @TableField(exist = false)
    private Integer storeCount;
    /**
     * 品牌名称
     */
    @TableField(exist = false)
    private String brandName;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Getter
    @AllArgsConstructor
    public enum BusinessMode {

        ONLINE(1, "线上"),
        OFFLINE(2, "线下"),
        ONLINE_OFFLINE(3, "线上线下")

        ;

        private Integer mode;
        private String description;

    }

    @Getter
    @AllArgsConstructor
    public enum StoreType {

        DIRECTLY(1, "直营"),
        LEAGUES(2, "加盟"),

        ;

        private Integer type;
        private String description;

    }

    @TableField(exist = false)
    private String username;

    @TableField(exist = false)
    private Integer undeliveredOrderCount;

    @TableField(exist = false)
    private SysMechantTypes mechantTypes;

}
